<template>
  <div>
    <van-nav-bar
      title="个人信息"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <van-form @submit="onSubmit">
      <van-field
        name="姓名"
        label="姓名"
        placeholder="姓名"
        :rules="[{ required: true, message: '请填写姓名' }]"
      />
      <van-field
        name="手机号码"
        label="手机号码"
        placeholder="手机号码"
        :rules="[{ required: true, message: '请填写手机号码' }]"
      />
      <van-field
        name="身份证号"
        label="身份证号"
        placeholder="身份证号"
        :rules="[{ required: true, message: '请填写身份证号' }]"
      />
      <van-field
        name="单位"
        label="单位"
        placeholder="单位"
        :rules="[{ required: true, message: '请填写单位' }]"
      />
      <van-field
        name="职务"
        label="职务"
        placeholder="职务"
        :rules="[{ required: true, message: '请填写职务' }]"
      />
      <van-field
        name="职级"
        label="职级"
        placeholder="职级"
        :rules="[{ required: true, message: '请填写职级' }]"
      />
      <van-field
        name="单位电话"
        label="单位电话"
        placeholder="单位电话"
        :rules="[{ required: true, message: '请填写单位电话' }]"
      />
      <div style="margin: 16px;">
        <van-button block type="primary" native-type="submit">提交信息</van-button>
      </div>
    </van-form>
  </div>
</template>

<script>
  export default {
    created() {
      this.$data.role = this.$route.query.role;
    },
    data() {
      var formJson = [
        {model:'username', name:'姓名', label:'姓名', placeholder:'姓名', message:'请填写姓名'},
        {model:'phoneNum', name:'手机号码', label:'手机号码', placeholder:'手机号码', message:'请填写手机号码'},
        {model:'identityNo', name:'身份证号', label:'身份证号', placeholder:'身份证号', message:'请填写身份证号'},
        {model:'company', name:'单位', label:'单位', placeholder:'单位', message:'请填写单位'},
        {model:'position', name:'职务', label:'职务', placeholder:'职务', message:'请填写职务'},
        {model:'rank', name:'职级', label:'职级', placeholder:'职级', message:'请填写职级'},
        {model:'phone', name:'单位电话', label:'单位电话', placeholder:'单位电话', message:'请填写单位电话'}
      ]
        return {
          role:-1,
          username: '',
          phoneNum: '',
          identityNo: '',
          company:'',
          position:'',
          rank:'',
          phone:'',
          formJson: formJson
        };
      },
      methods: {
        onSubmit(values) {
          console.log('submit', values);
        },
        onClickLeft() {
          this.$router.push({path:'/home',query:{role:this.$data.role}})
        },
      },
  }
</script>

<style>
</style>
